"""

@Date    ：2025-08-15 19:09 
"""
import os
import django
from celery import Celery
from celery.schedules import crontab
from django.conf import settings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'HostManage.settings')
django.setup()

celery_app = Celery('HostManage')
celery_app.config_from_object('django.conf:settings')
celery_app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

celery_app.conf.beat_schedule = {
    'set_host_root_password': {
        'task': 'app.tasks.set_host_root_password',
        'schedule': 60 * 60 * 8,
    },
    'record_host_quantity': {
        'task': 'app.tasks.record_host_quantity',
        'schedule': crontab(hour='0', minute='0'),
    },
}
